<template>
	<view>
		<view class="results-head-list">
			<table>
				<tr>
					<td class="list-td">别墅</td>
					<td>酒店</td>
					<td>度假</td>
				</tr>
			</table>
			<view class="list-hr">
			</view>
		</view>
		<view class="results-body-span">
			<view class="span-all" v-for="(v,i) in villainfo" @click="transmit(v)">
				<view class="span-img-text">
					<image :src="'../../static/image/'+v.villa_introduce" mode=""></image>
					<view class="span-text">
						{{v.villa_place}}
					</view>
				</view>
				<view class="span-title">
					<view class="title-lift">
						{{v.villa_name}}
					</view>
					<view class="title-price">
						价格详询客服
					</view>
				</view>
				<view class="results-data">
					<view class="img-data">
						<view class="img-bed">
							<image src="../../static/image/ico_6.svg"></image>
							<view class="bed">
								{{v.villa_rooms}}
							</view>
						</view>
						<view class="img-tub">
							<image src="../../static/image/ico_7.svg"></image>
							<view class="tub">
								{{v.villa_baths}}
							</view>
						</view>
						<view class="img-pool">
							<image src="../../static/image/ico_8.svg"></image>
							<view class="pool">
								{{v.villa_swmins}}
							</view>
						</view>
					</view>
					<view class="text-data">
						<view class="text-live">
							<text>住过</text>

							<view class="live">
								0
							</view>
						</view>
						<view class="tetx-hr">
							|
						</view>
						<view class="text-comment">
							<text>评论</text>

							<view class="comment">
								0
							</view>
						</view>
					</view>
				</view>
				<view class="data-hr"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from "@/static/js/api.js"
	export default {
		data() {
			return {
				villa_name: "",
				villainfo: [],
				villa_name:"",
				villa_id:"",
			}
		},
		onLoad: function(option) {
			if (option.name!=null) {
				this.villa_name=option.name
			}
			this.VillaInfo();
			wx.showShareMenu({
			    withShareTicket:true,
			    //设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
			    menus:["shareAppMessage","shareTimeline"]
			})
		},
		methods: {
			transmit(v){
				this.villa_name=v.villa_name,
				this.villa_id=v.villa_id,
				wx.reLaunch({
					url: "../../../commodity/pages/commodity_detail/commodity_detail?villa_name="+this.villa_name+"&villa_id="+this.villa_id   
				})
			},
			VillaInfo() {
				wx.request({
					url: api.api + '/VillaInfo/selectVillaInfo', // 仅为示例，并非真实的接口地址
					method: 'get',
					data: {
						pageSize:30,
						name:this.villa_name
					},
					header: {

					},
					success: res =>{
						uni.showLoading({
							title: '加载中'
						});
						setTimeout(()=>{
							uni.hideLoading();
							this.villainfo=res.data.data.list;
							console.log(res.data.data.list);
						},800)
					}
				})
			},
		},
		onShareAppMessage(res) {
		    if (res.from === 'button') {// 来自页面内分享按钮
		        console.log(res.target)
		    }
		    return {
		        title: 'title', //分享的名称
		        path: '/pages/myinfo/myinfo',
		        mpId:'wxb104bc1a12b9d850' //此处配置微信小程序的AppId
		    }
		},
	}
</script>

<style>
	@import url("../../static/css/results.css");
</style>
